﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using A2DFramework.EventService.Configuration;
using A2DFramework.InstanceService;

namespace A2DFramework.EventService
{
    public class EventBusService : IEventBus
    {
        private IEventBusProvider busProvider = ObjectFactory.Resolve<IEventBusProvider>();

        public void Publish(IEvent evt)
        {
            this.busProvider.Publish(evt);
        }

        public void Publish<T>(T evt)
            where T : IEvent
        {
            this.busProvider.Publish(evt);
        }

        public void Subscribe<T>() where T : IEvent
        {
            this.busProvider.Subscribe(typeof(T).FullName);
        }

        public void Subscribe(Type evtType)
        {
            this.busProvider.Subscribe(evtType.FullName);
        }
    }
}
